<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        table{
            border-collapse: collapse;
            text-align: center;
            
        }
        td, th{
            width: 100px;
            height: 50px;
            border: 1px solid black;
        }
        #hello{
            background-color: #944c4c;
            width: 200px;
        }
    </style>
</head>
<body>
    <div id="app1">
        <div v-bind:id="msg">
            <p>这里是msg </p>
        </div>
        <table v-on:mouseover="change" v-on:mouseout="change2">
            <thead>
                <tr>
                    <th>编号</th>
                    <th>姓名</th>
                    <th>性别</th>
                    <th>操作</th>
                </tr>
        
            </thead>
            <tbody>
                <tr v-for="(item, index) in list" :key="item.id">
                    <td>{{item.id}}</td>
                    <td>{{item.name}}</td>
                    <td v-show="check">
                        <span v-if="item.gender == 0">男

                        </span>
                        <span v-else-if="item.gender == 1">女</span>
                    </td>
                    <td>
                        <input type="button" value="编辑">
                        <input type="button" value="删除">
                    </td>
                </tr>
            </tbody>
        
        </table>
    </div>

    <script type="module">
        import { createApp} from "https://unpkg.com/vue@3/dist/vue.esm-browser.js";
        createApp({
            data(){
                return {
                    msg:"hello",
                    list:[
                            {"id":1, "name":"zhangsan", "gender":0},
                            {"id":2, "name":"lisi", "gender":1},
                            {"id":3, "name":"wangwu", "gender":0}
                    ],
                    check:false
                }
            },
            methods:{
                change(){
                    this.check = true;
                    },
                change2(){
                    this.check = false;
                    }
            }
            
        }).mount(" #app1");
    </script>
</body>
</html>